package com.scm.service.impl;

import java.util.List;

import com.scm.common.core.domain.entity.SysUser;
import com.scm.common.utils.DateUtils;
import com.scm.persist.model.ScmInquiry;
import com.scm.persist.model.ScmInquiryExample;
import com.scm.persist.mybatis.ScmInquiryMapper;
import com.scm.service.IScmInquiryService;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.scm.common.core.text.Convert;

/**
 * 询价单Service业务层处理
 *
 * @author reptilemanager
 * @date 2024-06-01
 */
@Service
public class ScmInquiryServiceImpl implements IScmInquiryService
{
    @Autowired
    private ScmInquiryMapper scmInquiryMapper;

    /**
     * 查询询价单
     *
     * @param id 询价单主键
     * @return 询价单
     */
    @Override
    public ScmInquiry selectScmInquiryById(Long id)
    {
        return scmInquiryMapper.selectByPrimaryKey(id);
    }

    /**
     * 查询询价单列表
     *
     * @param scmInquiry 询价单
     * @return 询价单
     */
    @Override
    public List<ScmInquiry> selectScmInquiryList(ScmInquiry scmInquiry, SysUser sysUser)
    {
        ScmInquiryExample example = new ScmInquiryExample();
        example.createCriteria().andTenantIdEqualTo(sysUser.getTenantId());
        return scmInquiryMapper.selectByExample(example);
    }

    /**
     * 新增询价单
     *
     * @param scmInquiry 询价单
     * @return 结果
     */
    @Override
    public int insertScmInquiry(ScmInquiry scmInquiry)
    {
        return scmInquiryMapper.insertSelective(scmInquiry);
    }

    /**
     * 修改询价单
     *
     * @param scmInquiry 询价单
     * @return 结果
     */
    @Override
    public int updateScmInquiry(ScmInquiry scmInquiry)
    {
        return scmInquiryMapper.updateByPrimaryKey(scmInquiry);
    }

    /**
     * 批量删除询价单
     *
     * @param ids 需要删除的询价单主键
     * @return 结果
     */
    @Override
    public int deleteScmInquiryByIds(String ids)
    {
        return 1;
    }

    /**
     * 删除询价单信息
     *
     * @param id 询价单主键
     * @return 结果
     */
    @Override
    public int deleteScmInquiryById(Long id)
    {
        return 1;
    }
}
